import { AxiosHeaders, AxiosProgressEvent, AxiosRequestHeaders, Method, RawAxiosRequestHeaders } from "axios"

/** 单文件上传的参数 */
export interface UploadData {
    name: string, file: File
}
export interface Options<D = any> {
    data: D,
    onUploadProgress?: (progressEvent: AxiosProgressEvent) => void,
    requestConfig?: UpladRequestConfig
}

export interface UpladRequestConfig {
    url: string,
    method: Method | string,
    headers: RawAxiosRequestHeaders | AxiosHeaders,
    timeout?: number
}
/** 上传返回的响应体数据 */
export interface UploadResponseData {
    link: string,//文件绝度地址
    name: string,//文件相对地址
    originalName: string,//文件名
    domain: string,//文件基础地址
}

// 上传图片的列表数据
export interface UploadDataItem {
    data: { [p: string]: any, path: string, },
    loading?: boolean //上传中
    error?: boolean //上传失败
    success?: boolean //上传成功
    tempFilePath?: string //临时文件地址
    errMsg?: string //验证错误信息
    progress?: number //上传进度
    isAdd?: boolean //是否是上传按钮
}

export interface TipConfig {
    accept?: string
    disabled?: boolean
    limit?: number
    multiple?: boolean
    size?: number //最大限制，单位M
    placeholder?: string //
    tip?: boolean
    specsWidthPx?: number //裁剪宽度
    specsHeightPx?: number //裁剪高度
    crop?: boolean //是否启用裁剪，裁剪模式下仅允许单个上传
}